#include <cstdio>
#include <iostream>
using namespace std;
const int N=300003,mod=998244353,inv2=(mod+1)/2;
int n,m,q,a[N],bx[N],by[N],cnt[N];
int lowbit(int x){
	return x&-x;
}
namespace BIT{
	int n,node[N];
	void init_BIT(int _n){ n=_n; }
	void modify(int u,int x){
		for(int i=u;i<=n;i+=lowbit(i))
			node[i]+=x;
	}
	int query(int u){
		int ans=0;
		for(int i=u;i>0;i-=lowbit(i))
			ans+=node[i];
		return ans;
	}
}
int pow(int a,int b){
	int ans=1;
	while(b>0){
		if(b&1) ans=(long long)ans*a%mod;
		a=(long long)a*a%mod; b>>=1;
	}
	return ans;
}
int read(){
	char ch; int x=0;
	do ch=getchar();
	while(ch<'0'||ch>'9');
	while(ch>='0'&&ch<='9')
		x=x*10+(ch-'0'),ch=getchar();
	return x;
}
void write(int x){
	char a[12]; int n=0,i;
	do a[++n]=x%10+'0';
	while((x/=10)>0);
	for(i=n;i>0;i--) putchar(a[i]);
	putchar('\n');
}
int main(){
	freopen("random.in","r",stdin);
	freopen("random.out","w",stdout);
	int i,j,s1,s2,s3,s4,ans,inv;
	n=read(),m=read(),q=read();
	for(i=1;i<=n;i++) a[i]=read();
	for(i=1;i<=q;i++)
		bx[i]=read(),by[i]=read();
	BIT::init_BIT(n);
	for(i=1;i<=n;i++){
		cnt[i]=i-BIT::query(a[i]-1)-1;
		BIT::modify(a[i],1);
	}
	for(i=0;i<=q;i++){
		if(i){
			if(bx[i]>by[i]) swap(bx[i],by[i]);
			swap(a[bx[i]],a[by[i]]),swap(cnt[bx[i]],cnt[by[i]]);
			(a[bx[i]]>a[by[i]])?(cnt[by[i]]++):(cnt[bx[i]]--);
			for(j=bx[i]+1;j<by[i];j++){
				(a[bx[i]]>a[j])?(cnt[j]++):(cnt[bx[i]]--);
				(a[j]>a[by[i]])?(cnt[by[i]]++):(cnt[j]--);
			}
		}
		inv=pow(n-2,mod-2);
		s3=pow((long long)n*(n-1)/2,mod-2);
		s1=(long long)(n-2)*(n-3)/2%mod*s3%mod;
		s2=(long long)(n-1)*(n-2)/2%mod*s3%mod;
		s1=pow(s1,m-q),s2=(pow(s2,m-q)-s1+mod)%mod;
		s3=((1-s1-s2*2%mod)%mod+mod)%mod,ans=0,s4=0;
		for(j=1;j<=n;j++){
			ans=(ans+(long long)cnt[j]*s1%mod)%mod;
			ans=(ans+(long long)(j-1-cnt[j])*inv%mod*(j-1)%mod*s2%mod)%mod;
			ans=(ans+(long long)s4*inv%mod*s2%mod)%mod;
			ans=(ans+(long long)inv2*(j-1)%mod*s3%mod)%mod;
			s4=(s4+a[j]-1)%mod;
		}
		write(ans);
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
